// *********************************************************
// economy contains the variable that stores the ammount
// of money the player currently has and prints it to the
// screen. The player starts with 1000 units of money.
// economy also displays ammount money spent buildind units.  
// *********************************************************

#include "DarkGDK.h"

class economy {

public:

	int money; //stores the current ammount of money
    char money_string; //for printing the money
	int display; //temp code
	int net; //temp code
	void create_economy( void ) {
		money = 1000; //the player should start with 1000 money
		dbLoadImage("money.png", 99); //the icon to indicate that the number represents money
	}

	void loop( ) {
			//prints out the economy variables
			dbSetCursor(255,255);
			dbInk(dbRGB(255,0,0),0);
			dbPrint("Bought unit, costed: $"); //print the price of the unit when bought
			
			dbSetCursor(255,275);
			dbPrint((double) display); 
			dbInk(dbRGB(255,255,255),0);
		
	}

	//print the current money to screen
	void display_money ( void ) {
		sprintf(&money_string, "%d", money);
		dbText(5, 5, &money_string); //print the number of money units
		dbSprite(99, 0, 0, 99); //print the money icon
	}

	//set the money variable and indicated when money subtracted 
	void set_money ( int new_money ) {
		net= new_money- money; //temp code
		if (net<0) display= net; //temp code

		money = new_money;
	}

};